/*
 * Copyright 2013 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.android.wizardpager.wizard.model;

import java.util.ArrayList;

import android.support.v4.app.Fragment;

import com.example.android.wizardpager.wizard.ui.DateFragment;

/**
 * A page offering the user a number of non-mutually exclusive choices.
 */
public class DatePage extends Page {
	
	private String label;
    public DatePage(ModelCallbacks callbacks, String title) {
        super(callbacks, title);
        label = "";
    }


	@Override
    public Fragment createFragment() {
        return DateFragment.create(getKey());
    }

    @Override
    public void getReviewItems(ArrayList<ReviewItem> dest) {      

    	StringBuilder sb = new StringBuilder();

        String s = mData.getString(Page.TEXT_DATA_KEY);
        if (s != null && s.length() > 0) {
            
                sb.append(s);
        }

        dest.add(new ReviewItem(getTitle(), sb.toString(), getKey()));
    }

    @Override
    public boolean isCompleted() {
    	String s = mData.getString(Page.TEXT_DATA_KEY);
        return s != null && s.length() > 0;
    }

	public String getLabel() {
		return label;
	}
	
	public DatePage setLabel(String Label) {
		label = Label;
        return this;
    }

	public String getTextData() {
		
		return mData.getString(Page.TEXT_DATA_KEY,"");
	}

	public void setTextData(String value) {
		
		mData.putString(Page.TEXT_DATA_KEY, value);
}
	
	
}
